home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CD Exchange
/
CD Exchange - Volume 1.iso
/
games
/
pd
/
ashido
/
source
/
ashido.asm
< prev
next >
Wrap
Assembly Source File
|
1988-10-07
|
54KB
|
2,264 lines
opt c-,l-,o1+,o2+,ow-
*****************************************************************************
* *
* A S H I D O *
* ~~~~~~~~~~~~~~~ *
* © by Aragorn of CLUSTER / HAWK 1990 *
* *
* Planned on 22.11.1990, Started on 04.11.1990, last update on 10.12.1990 *
* *
*****************************************************************************
* *
* Structure of a stage: 12x7 plots (bytes), one byte is divided into *
* two nibbles: xxxxyyyy, where x means the number of the color of the *
* tile and y the pattern of the tile (see label 'Area'). *
* Levels of difficulty: *
* *
* Level Clock Board Touch *
* ------------------------------------------------------ *
* Freestyle - - - *
* Scorer X - - *
* Explorer - X - *
* Pioneer X X - *
* Hero - X X *
* Einstein X X X *
* *
* For the different boards look at the label 'Table_1', -1 means empty *
* plot.Use the '<<'-opcode to create the high-nibble, '!' for the low one. *
* *
*****************************************************************************
incdir ram:include/
include libraries/dosextens.i
include exec/exec_lib.i
include exec/execbase.i
OpenLibrary equ -552
CloseLibrary equ -414
AllocMem equ -198
FreeMem equ -210
Forbid equ -132
Permit equ -138
FindTask equ -294
Output equ -60
Open equ -30
Close equ -36
Read equ -42
Write equ -48
Delay equ -198
BLTCON0 equ $040
BLTCON1 equ $042
BLTAFWM equ $044
BLTALWM equ $046
BLTCPTH equ $048
BLTBPTH equ $04C
BLTAPTH equ $050
BLTDPTH equ $054
BLTSIZE equ $058
BLTCMOD equ $060
BLTBMOD equ $062
BLTAMOD equ $064
BLTDMOD equ $066
DIWSTRT equ $08E
DIWSTOP equ $090
DDFSTRT equ $092
DDFSTOP equ $094
BPL1PTH equ $0E0
BPL1PTL equ $0E2
BPL2PTH equ $0E4
BPL2PTL equ $0E6
BPL3PTH equ $0E8
BPL3PTL equ $0EA
BPL4PTH equ $0EC
BPL4PTL equ $0EE
BPL5PTH equ $0F0
BPL5PTL equ $0F2
BPL6PTH equ $0F4
BPL6PTL equ $0F6
BPL1MOD equ $108
BPL2MOD equ $10A
BPLCON0 equ $100
BPLCON1 equ $102
BPLCON2 equ $104
DMACONW equ $096
DMACONR equ $002
COP1LCH equ $080
COPJMP1 equ $088
BLTAPTL equ $052
BLTADAT equ $074
BLTBDAT equ $072
JOY0DAT equ $00A
JOY1DAT equ $00C
SPR0PTH equ $120
CIAAPRA equ $001
VHPOSR equ $006
STARTLIST equ 38
SECTION "Startup",CODE
movem.l d0/a0,-(sp)
clr.l _WBenchMsg
sub.l a1,a1
CALLEXEC FindTask
move.l d0,a4
tst.l pr_CLI(a4)
beq.s _WB
movem.l (sp)+,d0/a0
bra.s _run
_WB lea pr_MsgPort(a4),a0
CALLEXEC WaitPort
lea pr_MsgPort(a4),a0
CALLEXEC GetMsg
move.l d0,_WBenchMsg
movem.l (sp)+,d0/a0
_run jsr _Main
move.l d0,-(sp)
tst.l _WBenchMsg
beq.s _Exit
CALLEXEC Forbid
move.l _WBenchMsg(pc),a1
CALLEXEC ReplyMsg
_Exit move.l (sp)+,d0
rts
_WBenchMsg ds.l 1
SECTION "Ashido",CODE
_Main move.l 4.w,a6 allocate mem and open libs
lea DOSName,a1
moveq #0,d0
jsr OpenLibrary(a6)
move.l d0,DosBase
lea $dff000,a5
move.l #2*5*256*40+10000+4+6*4+4+8,d0
move.l #$10002,d1
jsr AllocMem(a6)
tst.l d0
beq Error_1
move.l d0,Mem
move.l d0,Plane_1
add.l #5*256*40,d0
move.l d0,Plane_2
add.l #5*256*40,d0
move.l d0,Copper
add.l #10000,d0
move.l d0,Sprite
add.l #4+6*4+4,d0
move.l d0,Empty
move.l DosBase,a6
move.l #Filename,d1 try to load highscores
move.l #1005,d2
jsr Open(a6)
tst.l d0
beq.s .No_High
move.l d0,d7
move.l d7,d1
move.l #Highscores,d2
move.l #6*6*24,d3
jsr Read(a6)
move.l d7,d1
jsr Close(a6)
.No_High move.l 4.w,a6
bsr Create_Mask create tile-masks
bsr Set_RND set RND to rnd (uh...)
move.l Copper,a0 create copperlist
lea Colortable_1,a1
move.l #Cols_1/2-1,d0
move.l #$210ffffe,d1
SetCols_1 move.l d1,(a0)+
move.w #$180,(a0)+
move.w (a1)+,(a0)+
add.l #$01000000,d1
dbra d0,SetCols_1
move.l #$fffffffe,(a0)
jsr Forbid(a6) set registers
move.w #$7fff,DMACONW(a5)
move.l Copper,COP1LCH(a5)
clr.w COPJMP1(a5)
move.w #$3081,DIWSTRT(a5)
move.w #$30c1,DIWSTOP(a5)
move.w #$0038,DDFSTRT(a5)
move.w #$00d0,DDFSTOP(a5)
move.w #%0101000000000000,BPLCON0(a5)
move.w #0,BPLCON1(a5)
move.w #%0000000000100100,BPLCON2(a5)
move.w #0,BPL1MOD(a5)
move.w #0,BPL2MOD(a5)
move.l Sprite,a2 create sprites
move.w #0,(a2)+
move.w #0,(a2)+
lea sprptr,a1
moveq #6*2-1,d0
setptr move.w (a1)+,(a2)+
dbra d0,setptr
move.w #0,(a2)+
move.w #0,(a2)+
move.l Empty,a1
move.l #0,(a1)+
move.l #0,(a1)+
move.l Sprite,a0
move.l #268,d0
move.l #160,d1
move.l #274,d2
move.l #0,d3
bsr Set_Spritepos
move.l #268,ptr_x
move.l #268,prev_x
move.l #160,ptr_y
move.l #160,prev_y
move.w #%1000011111111111,DMACONW(a5)
move.l #0,Clockflag set IRQ-flags + IRQ-ptr
move.l #0,Scrollflag
bchg #1,$bfe001
jsr Start_Muzak
move.l $6c,OldIRQ+2
move.l #NewIRQ,$6c
move.l #5,GameMode Mode = Einstein
move.l #0,The_Flag clear the mysterious flag
Title move.l #0,Clockflag
bsr Clear_Plane
move.l #256*44,bpsize
move.w #%0100000000000000,BPLCON0(a5)
move.w #4,BPL1MOD(a5) change into overscan
move.w #4,BPL2MOD(a5) for scrolltext
move.l #1,Colorflag
lea Titleline_1,a0 give out ashido
move.l Plane_1,a1
addq.l #2,a1
bsr BigPrint
move.l #Text,vektor start scrolltext
move.l #8,Smooth
move.l #1,Scrollflag
Page_I lea Page_1,a0
moveq #7,d7
move.l #38*44,d6
.PrintPage move.l Plane_1,a1
add.l d6,a1
bsr Print
add.l #16*44,d6
dbra d7,.PrintPage
move.l #$70000,d0
move.b #0,$bfec01
.Wait subq.l #1,d0
beq.s Page_II
move.b $bfec01,d1
beq.s .NoKey
bsr Check_Key
tst.l d1
bne.s Page_II
.NoKey btst #6,$bfe001
bne.s .Wait
bra Start_Game
Page_II lea Page_2,a0
moveq #7,d7
move.l #38*44,d6
.PrintPage move.l Plane_1,a1
add.l d6,a1
bsr Print
add.l #16*44,d6
dbra d7,.PrintPage
lea Modi,a0
move.l Plane_1,a1
add.l #38*44,a1
move.l GameMode,d0
mulu #41,d0
add.l d0,a0
bsr Print
move.l #$70000,d0
move.b #0,$bfec01
.Wait subq.l #1,d0
beq.s Page_Highs
move.b $bfec01,d1
beq.s .NoKey
bsr Check_Key
tst.l d1
bne.s Page_II
.NoKey btst #6,$bfe001
bne.s .Wait
bra Start_Game
Page_Highs lea High_strings,a0
move.l GameMode,d0
mulu #41,d0
add.l d0,a0
move.l Plane_1,a1
add.l #38*44,a1
bsr Print
lea Empty_line,a0
move.l Plane_1,a1
add.l #54*44,a1
bsr Print
lea Highscores,a0
move.l GameMode,d0
mulu #6*24,d0
add.l d0,a0
moveq #5,d7
move.l #70*44,d6
.Print_Highs movem.l d0-d7/a0-a6,-(sp)
lea TextBuffer,a1
moveq #39,d0
.Clear_Buffer move.b #" ",(a1)+
dbra d0,.Clear_Buffer
move.b #0,(a1)
move.l (a0)+,d0
move.l #5,d1 give out Scores
moveq #0,d2
lea TextBuffer+6,a0
bsr BinDec
move.b #" ",5(a0)
movem.l (sp),d0-d7/a0-a6
lea TextBuffer+16,a1
addq.l #4,a0
moveq #23,d0
.CopyName move.b (a0)+,(a1)+
dbra d0,.CopyName
lea TextBuffer,a0
move.l Plane_1,a1
add.l d6,a1
bsr Print
movem.l (sp)+,d0-d7/a0-a6
add.l #24,a0
add.l #16*44,d6
dbra d7,.Print_Highs
move.l #$70000,d0
move.b #0,$bfec01
.Wait subq.l #1,d0
beq.s Page_III
move.b $bfec01,d1